<script>on mouseUpif Field "Text" is not empty thenbeep 1put card field "filename" into fnanswer "Clear file " & quote & fn & quote & "?" ¬with "Cancel" or "Clear"if it is "cancel" then exit mouseupif it is "Clear" then put empty into card Field "Poem"end ifGet FileName("TEXT")put it into filenameif filename is empty thenexit Mouseupelseput ShortFN(filename) into shortnameset width of card field "Filename" to ¬(number of chars in shortname * 10)put shortname into card field "Filename"if visible of card field "filename" is false thenshow card pictureshow card field "filename"show button "close box"show card field "poem"end ifopen file filenameread from file filename until emptyput it into field "text"close file filenameEnable MEnuitem 3 of menu "dadapoet"send mouseup to bg button "Make Poem"end ifend mouseUp</script>
</part>
<part>
<id>20</id>
<type>button</type>
<visible> <false /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>0</left>
<top>277</top>
<right>100</right>
<bottom>299</bottom>
</rect>
<style>roundrect</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Make Poem</name>
<script>on mouseUpglobal Titlewords,NLines,NWords,Nstanzasif field "text" is empty thenbeep 1answer "You must open a text file first, DaDa!"exit mouseupend ifput empty into card field "Poem"set scroll of card field "Poem" to 0if visible of card field "poem" is false thenshow card pictureshow button "close box"show card field "filename"show card field "poem"end ifput number of words in field "text" into Lastwordput random(Nstanzas - 1) + 1 into stanzasput the textheight of card field "poem" into tHtput the height of card field "poem" into htput empty into thislinerepeat for random(titlewords - 1) timesset cursor to busyput word random(lastword) of field "Text" into thiswordif char 1 of thisword = quote thendelete char 1 of thisworddelelete last char of thiswordput word random(number of words in thisword) of thisword into thiswordend ifif char 1 of thisword is in "[,(,{,<,“" then delete char 1 of thiswordif last char of thisword is in "],),>,},”" then delete last char of thiswordput thisline && thisword into thislineend repeatdelete first char of thislineput quote & thisline & quote into first line of card field "poem"put empty into thislineput 2 into linenumrepeat for stanzas timesrepeat for random(Nlines -1) + 1 timesrepeat for random(Nwords -1) + 1 timesset cursor to busyput word random(lastword) of field "Text" into thisword-- if random(100) <= 5 then put "Dada" into thiswordif char 1 of thisword = quote thendelete char 1 of thisworddelete last char of thiswordput word random(number of words in thisword) of thisword into thiswordend ifif char 1 of thisword is in "[,(,{,<,“" then delete char 1 of thiswordif last char of thisword is in "],),>,},”" then delete last char of thiswordput thisline && thisword into thislineend repeatadd 1 to linenumput thisline into line linenum of card field "poem"set scroll of card field "poem" to 9000put empty into thislineend repeatadd 1 to linenumend repeatadd 1 to linenumput "©" && The Date && "by DadaPoet" into thislineput Thisline into line linenum of card field "poem"set scroll of card field "poem" to 9000beep 1Enable Menuitem 4 of menu "DadaPoet"end mouseUp</script>
</part>
<part>
<id>21</id>
<type>button</type>
<visible> <false /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>0</left>
<top>298</top>
<right>100</right>
<bottom>320</bottom>
</rect>
<style>roundrect</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Save Poem</name>
<script>on mouseUpglobal PoemNumif card field "poem" is empty thenbeep 1answer "Dada, you must make a poem first!"exit mouseupend ifadd 1 to PoemNumget NewFileName("Save Dada Poem as?","Dada Poem" && poemNum)if it is empty thensubtract 1 from poemNumexit mouseupelseput it into filenameopen file filenamewrite card field "poem" to file filenameclose file filenameend ifend mouseUp</script>
</part>
<part>
<id>22</id>
<type>button</type>
<visible> <false /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>0</left>
<top>255</top>
<right>100</right>
<bottom>277</bottom>
</rect>
<style>roundrect</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <false /> </autoHighlight>
<sharedHighlight> <true /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>Quit</name>
<script>on mouseUpanswer "Quit to..." with "Cancel" or "Finder" or "Home"if it is "Cancel" then exit mouseupif it is "Finder" then domenu "Quit HyperCard"if it is "Home" then Go Homeend mouseUp</script>